<html>
<head>
<script language="JavaScript" type="text/javascript" src="cobra-main.js"></script>
</head>
<body>
Tag
<input id="cobra-tag" value="" tabindex="1"/><br />
Master key
<input id="cobra-master-key" type="password" tabindex="2"/>
Hash
<input id="cobra-password-hash" readonly tabindex="4"/>
<div id="ps-preferences" title="Preferences"></div>
<button id="cobra-generate" onclick="CobraGeneratePassword();" tabindex="3"/>Generate</button>
<a href="http://code.google.com/p/cobra-extension/issues/list" tabindex="5" onclick="window.open('http://code.google.com/p/cobra-extension/issues/list');"class="ps-feedback">feedback</a>
</body>
<script>

function CobraGeneratePassword(){
var options = CobraChromeExt._involvedPreferencesControl;
		var password_length = CobraChromeExt.getOptionValue(CobraChromeExt._involvedPreferencesControl,'input[type="radio"]:checked'); 
		var no_specials = CobraChromeExt.getOptionValue(CobraChromeExt._involvedPreferencesControl,'input[type="checkbox"]:checked')== undefined ? false : true;
					
		if (password_length == undefined){password_length = 8;}
		chrome.extension.sendRequest( {
					action : 'CalcPassword',
					master : document.getElementById('cobra-master-key').value,
					tag : document.getElementById('cobra-tag').value,
					hashWordSize : password_length,
					restrictSpecial : no_specials
						}, function(response) {
					document.getElementById('cobra-password-hash').value = response.content;
						});

}

</script>
</html>
